use proto_bytes::frame::ToEc;
use utils::ufmt;

use crate::error::AppErr;


pub mod handler;
pub mod status;
pub mod driver;

#[derive(ufmt::derive::uDebug, Clone, Copy)]
pub enum DoorErr {
    PickDoorTimeout = 0x11,
    PickDrorAlm = 0x12,
    StrawCloseFail = 0x13,
}

impl From<DoorErr> for AppErr {
    fn from(value: DoorErr) -> Self {
        Self::Door(value)
    }
}

impl ToEc for DoorErr {
    fn to_ec(self) -> u8 {
        self as _
    }
}

pub unsafe fn init() {
    driver::init();
}

